package lab02.test11;

//矩形类

public class Rectangle implements Printx {

    //属性：长，宽
    double length,width;

    //行为：赋值，面积，周长

   Rectangle(double x,double y){

        length=x;
        width=y;
    }

    double area(){

       return length*width;
    }

    double perimeter(){

        return 2*length+2*width;
    }

    @Override
    public void printMyWay() {

        System.out.println("该矩形的长length="+length);

        System.out.println("该矩形的宽width="+width);

        System.out.println("面积area="+area());

        System.out.println("周长perimeter="+perimeter());

    }
}
